$(function (){
    layui.use('form', function(){
        let form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(){
            let id=$("input[name='id']").val();
            let orderId=$("input[name='orderId']").val();
            let name=$("input[name='name']").val();
            let username=$("input[name='username']").val();
            let address=$("input[name='address']").val();
            let phone=$("input[name='phone']").val();
            let orderTime=$("input[name='orderTime']").val();
            let status=$("input[name='status']").val();
            console.log(id);
            console.log(username);
            console.log(address);
            console.log(phone);

            $.ajax({
                type    : 'PUT',
                url     : '/editOrder',
                data: {
                    "id": id,
                    "orderId": orderId,
                    "username": username,
                    "name": name,
                    "address": address,
                    "phone":phone,
                    "orderTime":orderTime,
                    "status":status,

                },
                dataType:"text"
            });
            //调用父页面实现窗口自动关闭和后台数据实时刷新
            window.parent.location.reload();
            var index=parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);

        });
    });
})